package org.msss.resource;

import java.io.IOException;

import org.newdawn.slick.opengl.TextureLoader;
import org.newdawn.slick.util.ResourceLoader;
import org.newdawn.slick.opengl.Texture;
import org.lwjgl.opengl.GL11;

/**
 * This class will store all of the images as global variables, for easy access
 * to images.
 * 
 * @author alanxoc3
 * 
 */
public final class ImageDB {

	public static Texture bkg_1;
	public static Texture bkg_2;

	public static Texture head_down;
	public static Texture head_left;
	public static Texture head_up;
	public static Texture head_right;

	public static Texture down_hand_0;
	public static Texture down_hand_1;
	public static Texture down_hand_2;
	public static Texture down_hand_3;
	public static Texture down_hand_4;
	public static Texture down_hand_5;
	public static Texture down_hand_6;
	public static Texture down_hand_7;
	public static Texture down_hand_8;

	public static Texture down_head_0;

	public static Texture down_foot_0;
	public static Texture down_foot_1;
	public static Texture down_foot_2;
	public static Texture down_foot_3;
	public static Texture down_foot_4;
	public static Texture down_foot_5;

	public static void init() {
		try {
			// get the image from file...
			head_down = TextureLoader.getTexture("PNG", ResourceLoader
					.getResourceAsStream("res/image/head_down.png"));
			head_left = TextureLoader.getTexture("PNG", ResourceLoader
					.getResourceAsStream("res/image/head_left.png"));
			head_up = TextureLoader
					.getTexture("PNG", ResourceLoader
							.getResourceAsStream("res/image/head_up.png"));
			head_right = TextureLoader.getTexture("PNG", ResourceLoader
					.getResourceAsStream("res/image/head_right.png"));

			bkg_1 = TextureLoader.getTexture("PNG",
					ResourceLoader.getResourceAsStream("res/image/test1.png"));
			bkg_2 = TextureLoader.getTexture("PNG",
					ResourceLoader.getResourceAsStream("res/image/test2.png"));

			down_hand_0 = TextureLoader.getTexture("PNG", ResourceLoader
					.getResourceAsStream("res/sprite/arm/down_hand1_0.png"));
			down_hand_1 = TextureLoader.getTexture("PNG", ResourceLoader
					.getResourceAsStream("res/sprite/arm/down_hand1_1.png"));
			down_hand_2 = TextureLoader.getTexture("PNG", ResourceLoader
					.getResourceAsStream("res/sprite/arm/down_hand1_2.png"));
			down_hand_3 = TextureLoader.getTexture("PNG", ResourceLoader
					.getResourceAsStream("res/sprite/arm/down_hand1_3.png"));
			down_hand_4 = TextureLoader.getTexture("PNG", ResourceLoader
					.getResourceAsStream("res/sprite/arm/down_hand1_4.png"));
			down_hand_5 = TextureLoader.getTexture("PNG", ResourceLoader
					.getResourceAsStream("res/sprite/arm/down_hand1_5.png"));
			down_hand_6 = TextureLoader.getTexture("PNG", ResourceLoader
					.getResourceAsStream("res/sprite/arm/down_hand1_6.png"));
			down_hand_7 = TextureLoader.getTexture("PNG", ResourceLoader
					.getResourceAsStream("res/sprite/arm/down_hand1_7.png"));
			down_hand_8 = TextureLoader.getTexture("PNG", ResourceLoader
					.getResourceAsStream("res/sprite/arm/down_hand1_8.png"));

			down_head_0 = TextureLoader.getTexture("PNG", ResourceLoader
					.getResourceAsStream("res/sprite/head/down_head_0.png"));

			down_foot_0 = TextureLoader.getTexture("PNG", ResourceLoader
					.getResourceAsStream("res/sprite/foot/down_foot_0.png"));
			down_foot_1 = TextureLoader.getTexture("PNG", ResourceLoader
					.getResourceAsStream("res/sprite/foot/down_foot_1.png"));
			down_foot_2 = TextureLoader.getTexture("PNG", ResourceLoader
					.getResourceAsStream("res/sprite/foot/down_foot_2.png"));
			down_foot_3 = TextureLoader.getTexture("PNG", ResourceLoader
					.getResourceAsStream("res/sprite/foot/down_foot_3.png"));
			down_foot_4 = TextureLoader.getTexture("PNG", ResourceLoader
					.getResourceAsStream("res/sprite/foot/down_foot_4.png"));
			down_foot_5 = TextureLoader.getTexture("PNG", ResourceLoader
					.getResourceAsStream("res/sprite/foot/down_foot_5.png"));

			// Make sure they are pixelated...
			head_down.setTextureFilter(GL11.GL_NEAREST);
			head_up.setTextureFilter(GL11.GL_NEAREST);
			head_left.setTextureFilter(GL11.GL_NEAREST);
			head_right.setTextureFilter(GL11.GL_NEAREST);
			bkg_1.setTextureFilter(GL11.GL_NEAREST);
			bkg_2.setTextureFilter(GL11.GL_NEAREST);

			down_hand_0.setTextureFilter(GL11.GL_NEAREST);
			down_hand_1.setTextureFilter(GL11.GL_NEAREST);
			down_hand_2.setTextureFilter(GL11.GL_NEAREST);
			down_hand_3.setTextureFilter(GL11.GL_NEAREST);
			down_hand_4.setTextureFilter(GL11.GL_NEAREST);
			down_hand_5.setTextureFilter(GL11.GL_NEAREST);
			down_hand_6.setTextureFilter(GL11.GL_NEAREST);
			down_hand_7.setTextureFilter(GL11.GL_NEAREST);
			down_hand_8.setTextureFilter(GL11.GL_NEAREST);

			down_head_0.setTextureFilter(GL11.GL_NEAREST);

			down_foot_0.setTextureFilter(GL11.GL_NEAREST);
			down_foot_1.setTextureFilter(GL11.GL_NEAREST);
			down_foot_2.setTextureFilter(GL11.GL_NEAREST);
			down_foot_3.setTextureFilter(GL11.GL_NEAREST);
			down_foot_4.setTextureFilter(GL11.GL_NEAREST);
			down_foot_5.setTextureFilter(GL11.GL_NEAREST);
		} catch (IOException ioe) {
			ioe.printStackTrace();
		}
	}
}
